﻿@using S4Store.Domain
@{
    S4Store.Domain.Administrator CurrentUser = (S4Store.Domain.Administrator)ViewBag.CurrentUser;
}
@model S4Store.Models.Markting.DTHDModel
@{
    Layout = null;
    ViewBag.Title = "DTHD";
}
<div style="height:100%; overflow:auto">
@Html.Action("ReportBar", "Common", Model.BarModel)
<div style=" width:100%; height:30px; background:#E5EDEF">
    <div ratio="#25" class="panelBar" style="height: 25px;">
	<ul class="toolBar">
	 @if (
                           CurrentUser.Position == S4Store.Domain.Position.SystemManager ||
                           CurrentUser.Position == S4Store.Domain.Position.SaleTutors ||
                           CurrentUser.Position == S4Store.Domain.Position.DealerTutors
                           )
		{
		<li class="historyrecord"><a  backtype="html" href="@Url.Action("AddImproveGuide", "ImproveGuide", new { guidetype = S4Store.Domain.ImproveGuide.ImproveGuideType.Markting.ToInt()  ,referdesc="营销管理>营销活动计划>活动计划>店头活动成功邀约率"})" target="dialog" width="60%"><span class="icon edit">填写改善指导建议</span></a></li>
		}
		<li class="historyrecord"><a  backtype="html" href="@Url.Action("DTHDHistory")" target="navtab" width="30%"  title=店头活动执行KPI历史数据查询"><span class="icon search">历史数据查询</span></a></li>
	</ul>
</div>
</div>
<div class="tabs" currentIndex="0" eventType="click">
		<div class="tabsHeader">
			<div class="tabsHeaderContent">
				<ul>
					<li><a href="javascript:;"><span>@Model.BarModel.Month.ToString("yyyy年M月") 店头活动执行KPI概况</span></a></li>
					<li><a href="javascript:;"><span>@Model.BarModel.Month.ToString("yyyy年M月") 店头活动质量KPI</span></a></li>
				</ul>
			</div>
		</div>
		<div class="tabsContent" >
			<div>
            <table  class="reporttable"  style="border-collapse:collapse; width:100%">     
    <tr height="198" style="height:148.5pt" class="vtr">
    <th width="60"  class="inputedheader"><div>执行月度</div></th>
    <th width="65"  class="inputedheader" colspan="2"><div>执行周</div></th>
    <th   class="calculated"><div>店头活动主题</div></th>
    <th   class="calculated"><div>店头活动计划时间</div></th>
    <th   class="calculated"><div>计划店头活动数</div></th>
    <th   class="calculated"><div>店头活动实际执行数</div></th>
    <th   class="calculated"><div>店头活动策划案成稿数</div></th>
    <th   class="calculated"><div>店头活动效果评估报告数</div></th>
    <th   class="calculated"><div>店头活动计划执行率</div></th>
    <th   class="calculated"><div>店头活动策划案成稿率</div></th>
    <th   class="calculated"><div>店头活动效果评估率</div></th>
</tr>

@{
    for (int i = 1; i <= 8; i++)
    {
        var weekdata = Model.Report.ExhibitionWeekDatas.FirstOrDefault(t => t.WeekIndex == i);
        var weekreport = new S4Store.Domain.ExhibitionKpi.ExhibitionWeekReport(Model.Report, i); 
        
            <tr height="26" style="height:19.5pt" class="xl65">
                @if (i == 1)
                {
                <td rowspan="8" align="center">@(Model.Report.Month)月</td>
                }
                @if (i % 2 == 1)
                {
                <td rowspan="2">第@((i - 1) / 2 + 1)周</td>
                }
                @if (i % 2 == 1)
                {
                <td align="center">周六</td>
                }
                else
                {
                <td align="center">周日</td>
                }
                @if (weekdata != null)
                {
                <td align="center">@weekdata.DTHDZT</td>
                <td align="center">@weekdata.DTHDZXSJ</td>
                }
                else
                {              
                <td></td>  
                <td></td>
                }
                @if (i % 2 == 1)
                {
                    <td rowspan="2" align="center">@weekreport.JHDTHDS</td>    
                }
                @if (i % 2 == 1)
                {               
                    <td rowspan="2" align="center">@weekreport.DTHDSJZXS.toInt(0)</td>
                }
                @if (i % 2 == 1)
                {
                    <td rowspan="2" align="center">@weekreport.DTHDCHACGS</td>
                }
                @if (i % 2 == 1)
                {
                    <td rowspan="2" align="center">@weekreport.DTHDXGPGBGS</td>
                }
                    @if (i % 2 == 1)
                {
                    <td rowspan="2" align="center" @S4Store.Utils.GetBgColor(weekreport.DTHDJHZXLV >= Model.Report.ExhibitionKpiStandard.DTHDJHZXLV)>@weekreport.DTHDJHZXLV.toInt()%</td>
                        
                }
                        
                        @if (i % 2 == 1)
                        {
                    <td rowspan="2" align="center" @S4Store.Utils.GetBgColor(weekreport.DTHDCHCGLV >= Model.Report.ExhibitionKpiStandard.DTHDCHCGLV)>@weekreport.DTHDCHCGLV.toInt()%</td>
                        }
                            @if (i % 2 == 1)
                            {
                    <td rowspan="2" align="center" @S4Store.Utils.GetBgColor(weekreport.DTHDXGPGLV >= Model.Report.ExhibitionKpiStandard.DTHDXGPGLV)>@weekreport.DTHDXGPGLV.toInt()%</td>
                            }
               
            </tr>
       
    }
}

<tr>
    <th colspan="5">合计</th>
    <td align="center">@Model.Report.JHDTHDS</td>
    <td align="center">@Model.Report.DTHDSJZXS.toInt(0)</td>
    <td align="center">@Model.Report.DTHDCHACGS</td>
    <td align="center">@Model.Report.DTHDXGPGBGS</td>
    <td align="center" @S4Store.Utils.GetBgColor(Model.Report.DTHDJHZXLV >= Model.Report.ExhibitionKpiStandard.DTHDJHZXLV)>@Model.Report.DTHDJHZXLV.toInt()%</td>
    <td align="center" @S4Store.Utils.GetBgColor(Model.Report.DTHDCHCGLV >= Model.Report.ExhibitionKpiStandard.DTHDCHCGLV)>@Model.Report.DTHDCHCGLV.toInt()%</td>
    <td align="center" @S4Store.Utils.GetBgColor(Model.Report.DTHDXGPGLV >= Model.Report.ExhibitionKpiStandard.DTHDXGPGLV)>@Model.Report.DTHDXGPGLV.toInt()%</td>
</tr>
<tr>
    <th colspan="5">考核标准</th>
    <td align="center"></td>
    <td align="center"></td>
    <td align="center"></td>
    <td align="center"></td>
    <td align="center">@Model.Report.ExhibitionKpiStandard.DTHDJHZXLV.toInt()%</td>
    <td align="center">@Model.Report.ExhibitionKpiStandard.DTHDCHCGLV.toInt()%</td>
    <td align="center">@Model.Report.ExhibitionKpiStandard.DTHDXGPGLV.toInt()%</td>
</tr>
        </table>
			</div>
			<div>
            <div>
            <table  class="reporttable"  style="border-collapse:collapse; width:100%">     
    <tr height="198" style="height:148.5pt" class="vtr">
    <th width="60"  class="inputedheader"><div>执行月度</div></th>
    <th width="65"  class="inputedheader" colspan="2"><div>执行周</div></th>
    <th   class="calculated"><div>店头活动主题</div></th>
    <th   class="calculated"><div>店头活动计划时间</div></th>
    <th   class="calculated"><div>店头活动投入资金</div></th>
    <th   class="calculated"><div>店头活动邀约目标数</div></th>
    <th   class="calculated"><div>店头活动成功邀约客户数</div></th>
    <th   class="calculated"><div>店头活动战败客二次消化数</div></th>
    <th   class="calculated"><div>店头活动单次客户集客成本(万)</div></th>
    <th   class="calculated"><div>店头活动邀约成功率</div></th>
    <th   class="calculated"><div>店头活动战败客二次消化率</div></th>
</tr>

@{
    for (int i = 1; i <= 8; i++)
    {
        var weekdata = Model.Report.ExhibitionWeekDatas.FirstOrDefault(t => t.WeekIndex == i);
        var weekreport = new S4Store.Domain.ExhibitionKpi.ExhibitionWeekReport(Model.Report, i); 
        
            <tr height="26" style="height:19.5pt" class="xl65">
                @if (i == 1)
                {
                <td rowspan="8" align="center">@(Model.Report.Month)月</td>
                }
                @if (i % 2 == 1)
                {
                <td rowspan="2">第@((i - 1) / 2 + 1)周</td>
                }
                @if (i % 2 == 1)
                {
                <td align="center">周六</td>
                }
                else
                {
                <td align="center">周日</td>
                }
                @if (weekdata != null)
                {
                <td align="center">@weekdata.DTHDZT</td>
                <td align="center">@weekdata.DTHDZXSJ</td>
                }
                else
                {              
                <td></td>  
                <td></td>
                }
                @if (i % 2 == 1)
                {
                    <td  rowspan="2" align="center">@weekreport.DTHDTRZJ</td>
                }
                @if (i % 2 == 1)
                {
                    
                    <td  rowspan="2" align="center">@weekreport.DTHDMBYYS</td>
                }
                @if (i % 2 == 1)
                {
                   
                    <td  rowspan="2" align="center">@weekreport.DTHDCGYYS</td>
                }
                @if (i % 2 == 1)
                {
                    <td  rowspan="2" align="center">@weekreport.DTHDZBKECXHS</td>
                }
                    @if (i % 2 == 1)
                {
                    <td rowspan="2" align="center" @S4Store.Utils.GetBgColor(weekreport.DTHDDCKHJKCB >= Model.Report.ExhibitionKpiStandard.DTHDDCKHJKCB)>@weekreport.DTHDDCKHJKCB.toInt(3)</td>
                        }
                        @if (i % 2 == 1)
                {
                    <td rowspan="2" align="center" @S4Store.Utils.GetBgColor(weekreport.ZTHDYYCGLV >= Model.Report.ExhibitionKpiStandard.ZTHDYYCGLV)>@weekreport.ZTHDYYCGLV.toInt(1)%</td>
                            }
                @if (i % 2 == 1)
                {
                    <td rowspan="2" align="center" @S4Store.Utils.GetBgColor(weekreport.DTHDZBKECXHLV >= Model.Report.ExhibitionKpiStandard.DTHDZBKECXHLV)>@weekreport.DTHDZBKECXHLV.toInt(1)%</td>
                }
                
            </tr>
       
    }
}
<tr>
    <th colspan="5">合计</th>
    <td align="center">@Model.Report.DTHDTRZJ</td>
    <td align="center">@Model.Report.DTHDMBYYS</td>
    <td align="center">@Model.Report.DTHDCGYYS</td>
    <td align="center">@Model.Report.DTHDZBKECXHS</td>
    <td align="center" @S4Store.Utils.GetBgColor(Model.Report.DTHDDCKHJKCB >= Model.Report.ExhibitionKpiStandard.DTHDDCKHJKCB)>@Model.Report.DTHDDCKHJKCB.toInt(3)</td>
    <td align="center" @S4Store.Utils.GetBgColor(Model.Report.ZTHDYYCGLV >= Model.Report.ExhibitionKpiStandard.DTHDYYCGLV)>@Model.Report.ZTHDYYCGLV.toInt(1)%</td>
    <td align="center" @S4Store.Utils.GetBgColor(Model.Report.DTHDZBKECXHLV >= Model.Report.ExhibitionKpiStandard.DTHDZBKECXHLV)>@Model.Report.DTHDZBKECXHLV.toInt(1)%</td>
</tr>
<tr>
    <th colspan="5">考核标准</th>
    <td align="center"></td>
    <td align="center"></td>
    <td align="center"></td>
    <td align="center"></td>
    <td align="center">@Model.Report.ExhibitionKpiStandard.DTHDDCKHJKCB.toInt(3)</td>
    <td align="center">@Model.Report.ExhibitionKpiStandard.DTHDYYCGLV.toInt()%</td>
    <td align="center">@Model.Report.ExhibitionKpiStandard.DTHDZBKECXHLV.toInt()%</td>
</tr>
        </table>
			</div>
			</div>
		</div>
		<div class="tabsFooter">
			<div class="tabsFooterContent"></div>
		</div>
	</div>

        
</div>

